package com.systar.activity.parse;

import org.junit.Test;

import com.castsoftware.java.FileExplorerMock.FileMock;
import com.systar.activity.monitor.ActivityManager;
import com.systar.activity.monitor.ActivitySource;
import com.systar.activity.state.FileActivity;

public class SessionFileParserLexerTest extends ParseEnvironment
{
	/**
	 * Run parser with standard configuration 4 parsing events are expected 3
	 * errors inside log file
	 * 
	 * @throws Exception
	 *             if any error
	 */
	@Test
	public void testStandard() throws Exception
	{
		// configure virtual file
		final FileMock logFile = explorerMock.createFile(rootDir, "LogSession.xsession");
		logFile.addContent(getResourceContent("LogSession.xsession"));

		runTest(3, new ParserBuilder()
		{
			@Override
			public FileParser buildParser(ActivityManager manager, ActivitySource source)
			{
				FileActivity activity = new FileActivity(source, logFile);
				SessionFileParserLexer parser = new SessionFileParserLexer(activity, source.getEventBus());
				return parser;
			}

		});
	}

}
